<extend name="Layout/ins_page" />
<block name="content">
   <link href="/sap/demo.css" rel="stylesheet" type="text/css" />
    <script src="/sap/scripts/boot.js" type="text/javascript"></script>



        <legend><span></span></legend>
        <div  id='fm1'>
        <div class="fieldset-body">
        
    
		 
		 <span>物料编号</span>
		<input  class="mini-textbox" id='ItemCode'  /><br/><br/>
		 <span>物料描述</span>
		<input  class="mini-textbox" id='Dscription'  />
		
		 <span>仓库代码</span>
		<input  class="mini-textbox" id='whsCode'  />
		

		
		
	
	<br/>
    <a class="mini-button" onclick="search()" enabled="" id='query-bt'  style="margin-top: 5px">&nbsp;&nbsp;查询&nbsp;&nbsp;</a> 
 
  
   
    <div id="tabs1" class="mini-tabs" activeIndex="0" style="width:100%;margin-top: 5px;overflow:auto;" plain="false"
    buttons="#tabsButtons"
>
    <div title="查询结果" >
   
   <div id="datagrid1" class="mini-datagrid" style="height:430px;width: 100%;" 
        url="/warehouse/getStockData" idField="id" showPager='false'
        allowResize="true" 
        allowCellEdit="true" allowCellSelect="true" multiSelect="true"
        allowCellValid="true" oncellvalidation="" 
    >
    
        <div property="columns">
           
             <div field="ItemCode"  headerAlign="center"  >物料编号
                <input property="" class="mini-textbox" style="width:100%;" />
            </div>
            <div field="classification"  headerAlign="center"  >一级分类
                <input property="" class="mini-textbox" style="width:100%;" />
            </div> 
             <div field="U_Brand"  headerAlign="center"  >品牌
                <input property="" class="mini-textbox" style="width:100%;" />
            </div>
            <div field="U_FWID"  headerAlign="center"  >发网物料编号
                <input property="" class="mini-textbox" style="width:100%;" />
            </div>
           <div field="ItemName"  headerAlign="center"  >料编描述
                <input property="" class="mini-textbox" style="width:100%;" />
            </div>
            <div field="WhsCode"  headerAlign="center"  >仓库代码
                <input property="" class="mini-textbox" style="width:100%;" />
            </div>
            <div field="OnHand"  headerAlign="center"  >存货量
                <input property="" class="mini-textbox" style="width:100%;" />
            </div> 
            <div field="ItemCB"  headerAlign="center"  > 物料成本
                <input property="" class="mini-textbox" style="width:100%;" />
            </div> 
            <div field="TotalCB"  headerAlign="center"  >成本总额
                <input property="" class="mini-textbox" style="width:100%;" />
            </div> 
         
          
        </div>
    </div>
    
    </div>
    <!-- <div title="Tab2" iconCls="" >
        2
    </div> -->
</div>
</div>
</div>


</body>
<script type="text/javascript">
        mini.parse();
        var grid = mini.get("datagrid1");
        grid.on("drawcell", function (e) {
        var record = e.record,
        column = e.column,
        field = e.field,
        value = e.value;

          
            if (field == "OnHand"||field=='ItemCB'||field=='TotalCB') {
                var tempNumber = parseFloat(value);
                if(!isNaN(tempNumber)){
             	   e.cellHtml = tempNumber;
                }else{
             	   e.cellHtml = '0.00';
                }
             }
            
            if (field == "ItemCode") {
                e.cellHtml = '<a id="' + value + '" class="showCellTooltip" data-placement="bottomleft">' +value+ '</a>';
            }
            

        });

        function search(){
        	var itemCode = mini.get('ItemCode').getValue();
        	var dscription = mini.get('Dscription').getValue();
        	var warehouse = mini.get('whsCode').getValue();
        	grid.load({itemCode:itemCode,dscription:dscription,warehouse:warehouse})
        }
       

        
        
    	var box;
    	jQuery('.showCellTooltip').live('click', function() {
    		mini.hideMessageBox(box);
    		
    		mini.mask({
    			el : document.body,
    			cls : 'mini-mask-loading',
    			html : '加载库存信息..'
    		});
    		
    		var id = jQuery(this).html();
    		$.ajax({
    			url : "/sap/getware.php",
    			data : {
    				id : id
    			},
    			async : true,
    			success : function(text) {
    				mini.unmask(document.body);
    				htmlClick(text);

    			}
    		});
    	})

    	function htmlClick(htmlContent) {
    		box = mini.showMessageBox({
    			width : 550,
    			title : "库存情况",
    			html : htmlContent,
    			showModal : false,
    		});
    	}
     
	
</script>
    </block>

